home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lantools / blueprnt / prinserv.mod < prev    next >
Text File  |  1989-09-27  |  3KB  |  87 lines

  1. ;************************************************************
  2. ;* BP-LAN Print Server Module                (PRINSERV.MOD) *
  3. ;* by Craig Chaiken                                         *
  4. ;* September 21, 1989                                       *
  5. ;*                                                          *
  6. ;* Function :    Print Characters to Specified Printer      *
  7. ;************************************************************
  8. ;
  9.  
  10. ;*** Variables ***
  11. ;
  12. parown  dw      3 dup ('UU',546,0,0)  ;546=# of Clock Ticks in 30 seconds
  13.  
  14. prinser proc    near            ;*** Test for Print Block Commands ***
  15.         mov     al,packet_buffer
  16.         cmp     al,'P'
  17.         jnz     prins1
  18.         jmp     parallel
  19. prins1: cmp     al,'S'
  20.         jnz     prins2
  21.         jmp     serial
  22. prins2: ret
  23. prinser endp
  24.  
  25. parallel        proc    near    ;*** Print Characters to Parallel Printer ***
  26.                                 ;*** Obtain or Release Printer Ownership ***
  27.         push    bx
  28.         push    cx
  29.         push    dx
  30.         push    si
  31.         lea     si,parown
  32.         mov     bl,packet_buffer+2
  33.         xor     bh,bh
  34.         mov     cl,3
  35.         shl     bx,cl
  36.         add     si,bx
  37.         mov     bl,socket_num
  38.         cmp     [si+1],bl               ;Is the printer owned by this client?
  39.         jz      paral1
  40.         cmp     byte ptr [si],'U'       ;Is the printer unused?
  41.         jnz     paral2
  42. paral0: mov     byte ptr [si],'L'       ;Change ownership to this client
  43.         mov     bl,socket_num
  44.         mov     [si+1],bl
  45. paral1: mov     ah,packet_buffer+1      ;Print Character
  46.         mov     dl,packet_buffer+2
  47.         mov     al,packet_buffer+3
  48.         xor     dh,dh
  49.         int     17h
  50.         call    get_ticks
  51.         mov     [si+4],cx
  52.         mov     [si+6],dx
  53. paral3: mov     packet_buffer,ah        ;Return Printer Status
  54.         put_packet      socket_num,1,offset packet_buffer
  55.         pop     si
  56.         pop     dx
  57.         pop     cx
  58.         pop     bx
  59.         ret
  60. paral2: call    get_ticks
  61.         sub     cx,[si+4]
  62.         sbb     dx,[si+6]
  63.         cmp     dx,0
  64.         jnz     paral0
  65.         cmp     cx,[si+2]
  66.         ja      paral0
  67.         mov     ah,0ffh         ;Indicate that printer is locked
  68.         jmp     paral3
  69. parallel        endp
  70.  
  71. serial          proc    near    ;*** Print Characters to Serial Printer ***
  72.                                 ;*** Obtain or Release Printer Ownership ***
  73.         mov     ah,packet_buffer+1
  74.         mov     dl,packet_buffer+2
  75.         mov     al,packet_buffer+3
  76.         xor     dh,dh
  77.         int     14h
  78.         mov     packet_buffer,ah
  79.         mov     packet_buffer+1,al
  80.         put_packet      socket_num,2,offset packet_buffer
  81.         ret
  82. serial          endp
  83.  
  84. ;************************************************************
  85. ;* End of Network Print Server Module                       *
  86. ;************************************************************
  87.